package com.miracle9.game.service;

import com.miracle9.game.dao.WaterDeskThirtyMinResultServiceDao;
import com.miracle9.game.bean.Pager;
import com.miracle9.game.util.MyUtil;
import org.apache.mina.core.session.IoSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("waterDeskThirtyMinResultService")
public class WaterDeskThirtyMinResultService extends BaseService {

    @Autowired
    private WaterDeskThirtyMinResultServiceDao waterDeskThirtyMinResultServiceDao;

    public Pager getWaterDeskThirtyMinResult(int deskId, String startDate, String endDate, Pager pager, IoSession session) {
        if (pager.getOrderBy() == "") {
            pager.setOrderBy("startDate");
            pager.setOrder("desc");
        }
        //endDate = MyUtil.DateByDayCalendar(endDate, 1);
        return this.waterDeskThirtyMinResultServiceDao.q_CreateSqlsPager("from WaterDeskThirtyMinResult where startDate>=? and endDate<=? and deskId=?", pager, new Object[]{startDate, endDate, Integer.valueOf(deskId)});
    }

}
